<?php

namespace libs\database;

class Connector extends \libs\database{
    
    public static $_config;
    private static $_connection;
    
    public function __construct($config) 
    {
        self::$_config = $config;
    }
    
    public static function choose() 
    {
        if(empty(self::$_connection))
        {
            $driver = 'libs\database\\'.self::$_config->driver . '\\connect';

            $object = new $driver(self::$_config);

            self::$_connection = $object->connect();
        }
        
        return self::$_connection;
    }
}

?>
